package com.uriuniv.service;

import java.sql.SQLException;
import java.util.List;

import com.uriuniv.dao.StudentD;
import com.uriuniv.dao.UniversityD;
import com.uriuniv.domain.Student;
import com.uriuniv.domain.University;

public class StudentS {
	
	private StudentD studentD;

	public void setStudentD(StudentD studentD) {
		this.studentD = studentD;
	}
	
	public Student getStudentByName(String name){
		Student student = null;
		try{
			student = studentD.getStudentByName(name);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return student;
	}
	
	public Student getStudentByEmail(String email) {
		Student student = null;
		try{
			student = studentD.getStudentByEmail(email);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return student;
	}
	
	public int certification(String key) {
		
		int result = 0;
		
		try{
			result = studentD.certification(key);
		}catch(SQLException e){
			e.printStackTrace();
		}
		
		return result;
		
	} 
	
	public int insertStudent(Student student){
		
		int result = 0;
		
		try {
			result = studentD.insertStudent(student);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return result;
	}
	
}
